package com.reeygu.item.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.reeygu.item.mapper.OrderMapper;
import com.reeygu.item.pojo.Order;
import com.reeygu.item.pojo.User;
import com.reeygu.item.service.OrderService;
import com.reeygu.item.utils.MD5Util;
import com.reeygu.item.utils.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
* @author a1304
* @description 针对表【t_order】的数据库操作Service实现
* @createDate 2023-08-05 00:21:25
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>
implements OrderService {

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public String createSeckillPath(User user, Long goodsId) {
        String path = MD5Util.md5(UUIDUtil.uuid() + "e5ry23103rds");
        redisTemplate.opsForValue().set("seckillPath:" + user.getId() + ":" + goodsId, path);
        return path;
    }
}
